package com.swipemaster.game;

public class ClockTime
{
	/** Start time of last measure. */
	private long startTime;
	/** Total miliseconds. */
	private long totalMs;

	/** @return Interval added to playing time. */
	public long addPlayingTime()
	{
		final long now = System.currentTimeMillis();
		final long interval = now - startTime;
		totalMs += interval;
		startTime = now;
		return interval;
	}

	/** @return Amount of seconds that player spend on this level, with two digits after decimal separator. */
	public double getPlayingTime()
	{
		return ((totalMs / 1000.0) * 100) / 100.0;
	}

	public void reset()
	{
		startTime = System.currentTimeMillis();
	}
}
